﻿<Window x:Class="SquatSimulator.MainForm"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Squat effect simulator"         
        SizeToContent="WidthAndHeight"
        ResizeMode ="NoResize">
    
    <Window.Resources>
        <Style TargetType="Label">
            <Setter Property="Margin" Value="0"/>
            <Setter Property="Padding" Value="0,5,0,5"/>
        </Style>
        <BooleanToVisibilityConverter x:Key="BoolToVis" />
    </Window.Resources>        
    <Grid >
        <Grid.ColumnDefinitions>            
            <ColumnDefinition Width="auto" />
            <ColumnDefinition Width="auto"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>
        
        <GroupBox>
            <GroupBox.Header>
                Runtime Information:
            </GroupBox.Header>

            <Grid Margin="10">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>                    
                </Grid.RowDefinitions>
                <Label Grid.Row="0" HorizontalAlignment="Left" >Engine Order Sate:</Label>
                <Label Grid.Row="1" HorizontalAlignment="Left" >Engine Order:</Label>
                <Label Grid.Row="2" HorizontalAlignment="Left" >Velocity:</Label>
                <Label Grid.Row="3" HorizontalAlignment="Left" >Depth:</Label>
                <Label Grid.Row="4" HorizontalAlignment="Left" >Time:</Label>
                
                <Label Grid.Row="5" Grid.ColumnSpan="3" HorizontalAlignment="Center" Foreground="Red"
                       Visibility="{Binding Path=IsGrounded, Converter={StaticResource BoolToVis}}">Grounded!</Label>

                <Label Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right" Content="{Binding Path=OrderState}" ContentStringFormat=" {0:##0}"></Label>
                <Label Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" Content="{Binding Path=Velocity }" ContentStringFormat=" {0:#0.0}"></Label>
                <Label Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" Content="{Binding Path=Depth}" ContentStringFormat=" {0:####0}"></Label>
                
                <Label Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Content="{Binding Path=Order}" ContentStringFormat=" {0:####0.0}"></Label>
                <Label Grid.Row="4" Grid.Column="1" HorizontalAlignment="Right" MaxWidth="100">
                    <Label.Content>
                        <TextBlock>
                            <TextBlock.Text>
                                <MultiBinding StringFormat="{}{0}:{1:00}:{2:00}">
                                    <Binding Path="Time.Hours"/>
                                    <Binding Path="Time.Minutes"/>                                    
                                    <Binding Path="Time.Seconds"/>
                                </MultiBinding>
                            </TextBlock.Text>
                        </TextBlock>
                    </Label.Content>                    
                </Label>

                <Label Grid.Row="0" Grid.Column="2" HorizontalAlignment="Left" >, %</Label>
                <Label Grid.Row="1" Grid.Column="2" HorizontalAlignment="Left" >, %</Label>
                <Label Grid.Row="2" Grid.Column="2" HorizontalAlignment="Left" >, knts</Label>
                <Label Grid.Row="3" Grid.Column="2" HorizontalAlignment="Left" >, m</Label>
                <Label Grid.Row="4" Grid.Column="2" HorizontalAlignment="Left" >, hh:mm:ss</Label>
            </Grid>
        </GroupBox>            
        <GroupBox Grid.Column="1" Grid.RowSpan="2">
            <GroupBox.Header>
                Controls:
            </GroupBox.Header>
            <Slider Value="{Binding Path=Order, Mode=TwoWay}" Orientation="Vertical"
                    Name="OrderSlider"
                    Minimum="-100" Maximum="100" Interval="10">
            </Slider>
           
        </GroupBox>
        
        <GroupBox Grid.Row="1" >
            <GroupBox.Header>
                Instructor section:
            </GroupBox.Header>

            <Grid Margin="10">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="10pt"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                </Grid.RowDefinitions>
                <Label Grid.Row="0" HorizontalAlignment="Left" >Sinkage:</Label>
                <Label Grid.Row="1" HorizontalAlignment="Left" >Depth:</Label>

                <Label Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right" Content="{Binding Path=Sinkage}" ContentStringFormat=" {0:####0.00}"></Label>
                <TextBox Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" MinWidth="50px"  Text="{Binding Path=Depth, Mode=TwoWay}" ></TextBox>

                <Label Grid.Row="0" Grid.Column="2" HorizontalAlignment="Left" >, m</Label>
                <Label Grid.Row="1" Grid.Column="2" HorizontalAlignment="Left" >, m</Label>
                <Button Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Center" MinWidth="70px"  >Apply</Button>


                <Label Grid.Row="0" Grid.Column="4" HorizontalAlignment="Left" >Pitch:</Label>
                <Label Grid.Row="1" Grid.Column="4" HorizontalAlignment="Left" >Draft forward:</Label>
                <Label Grid.Row="2" Grid.Column="4" HorizontalAlignment="Left" >Draft after:</Label>

                <Label Grid.Row="0" Grid.Column="5" HorizontalAlignment="Right" Content="{Binding Path=Pitch}" ContentStringFormat=" {0:####0.00}"></Label>
                <Label Grid.Row="1" Grid.Column="5" HorizontalAlignment="Right" Content="{Binding Path=BowDraft}" ContentStringFormat=" {0:####0.00}"></Label>
                <Label Grid.Row="2" Grid.Column="5" HorizontalAlignment="Right" Content="{Binding Path=SternDraft}" ContentStringFormat=" {0:####0.00}"></Label>

                <Label Grid.Row="0" Grid.Column="6" HorizontalAlignment="Left" >, deg</Label>
                <Label Grid.Row="1" Grid.Column="6" HorizontalAlignment="Left" >, m</Label>
                <Label Grid.Row="2" Grid.Column="6" HorizontalAlignment="Left" >, m</Label>

            </Grid>
        </GroupBox>

    </Grid>
</Window>
